package com.example.controller;

import com.alibaba.nacos.api.config.annotation.NacosValue;
import com.example.entity.User;
import com.example.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author : ChenYuan
 * @date : Created in 2020/8/13  15:26
 * @description:
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserMapper userMapper;

    @NacosValue(value = "${service.test:1}" ,autoRefreshed = true)
    private String str;

    @GetMapping
    public List<User> get() {
        return userMapper.selectList(null);
    }

    @GetMapping(value = "/test")
    public String test() {
        return str;
    }
}
